Herb Schildt's C++ Programming Cookbook by Herbert Schildt

Herb Schildt's C++ Programming Cookbook by Herbert Schildt

Author:Herbert Schildt
Language: eng
Format: mobi
Publisher: McGraw-Hill Companies,Inc.
Published: 2012-06-07T22:00:00+00:00


Example

The following example shows examples both unary and binary function objects. It reworks the example program for the recipe Use transform( ) to Change a Sequence. In that version, function pointers are passed to the transform( ) algorithm. The functions compute the reciprocal of a value and the midpoint between two values. This version of the program uses function objects instead of function pointers. It creates a unary function object class called reciprocal that computes the reciprocal of a value. It creates a binary function object class called midpoint that computes the midpoint between two values.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.